Creating and Downloading Waveforms

This topic describes the requirements and procedure for creating and downloading waveforms for playback on the VXG signal generator.

For more detailed information on waveform file creation and theory, refer to the Keysight Technologies Signal Generators; Creating and Downloading Waveforms document.

Waveform File Requirements

The VXG signal generator supports the following waveform file types:

Format

File Extension

Description

Signal Studio

*.wfm

Waveforms exported from Keysight Signal Studio applications.

Keysight 16-bit binary

*.wiq

*.bin

*.WAVEFORM

Contains interleaved I/Q samples (I0, Q0, I1, Q1, …). Values must be stored in 16-bit signed integers. The Default Binary File Format can be set to either Big Endian or Little Endian.

See Keysight 16-Bit Binary below.

ASCII

*.csv

*.txt

Two floating-point numbers (one for I and the other for Q) delimited by a comma, a tab or a whitespace, should appear in each line. Each line can have more than two values, but only the first two values are read as IQ point data. For example, the csv file may have values for I, Q, Marker1, Marker2, Marker3, and Marker4 in one line. In this case, only the first two values in the line are imported as an IQ point. The rest of the values are discarded. Only UTF-8 encoding with and without BOM is supported.

If the max abs value of I or Q is less than or equal to 1.0, no scaling is applied to the IQ data. If it is more than 1.0, the IQ data is normalized with the max abs value of I or Q.

Sequence

*.seq

Created by Keysight signal generators.

MATLAB

*.mat

The MAT file format (version 4, 6, 7, and 7.3) and the HDF5 format are supported.

See MATLAB below.

Keysight 16-Bit Binary

Binary waveform files must conform to these requirements:

How do I make my waveform a multiple of eight samples?

You can add zeros to the I/Q data until your waveform is exactly a multiple of eight samples, that is, dividing by eight yields an integer value. This method may not be suitable for continuous waveforms; in those cases, you can repeat the waveform up to eight times to achieve the same result.

SCPI Example

Use the MMEMory:DATA command to transfer the contents of the binary waveform file into the signal generator:

A

my_file.wiq

enter a file name to apply to the I/Q file in the signal generator's memory catalog

B

#

indicates the start of the data block

C

3

D has three decimal digits

D

240

240 bytes of data to follow in E

E

12%S!4&07#8g*Y9@7...

representation of some of the binary data downloaded to the signal generator

Then use the following commands to select the waveform file to play and set the signal’s characteristics:

SOURce:SIGNal:WAVeform:SELect "my_file.wiq"

SOURce:SIGNal:WAVeform:SCLock:RATE <sample rate in frequency>

SOURce:SIGNal:WAVeform:RMS <range 0.1 to 1.0>

SOURce:SIGNal:STATe ON

The above example is for channel 1, if your instrument supports multi-channe,l apply the appropriate channel designators.

MATLAB

The MAT file format (version 4, 6, 7, and 7.3) and the HDF5 format are supported. Only arrays in the mat file or the hdf5 file are imported as data, and scalar values are ignored. If there is only one array in the file, it is treated as an array of interleaved I/Q samples (I0, Q0, I1, Q1, …). If there are more than one array, simple case insensitive variable naming rules are applied to identify I, Q, and Marker data in the file.

In the case where IQ data are floating values, if the max abs value of I or Q is less than 1.0, no scaling is applied to the IQ data from the matlab file. If it is more than 1.0, the IQ data is normalized with the max abs value of I or Q. The IQ data is also scaled in the same way for Int32, as well. 

Marker data array in the matlab file is used only when the associated wmk doesn’t exist. For example, if there are myWaveform.mat and myWaveform.wmk in the same folder, myWaveform.wmk is used as marker data even if myWaveform.mat has the marker data array.

MATLAB Examples

Example 1. I and Q are created as a complex array.

dataSize = 2560;

phase = 10 * (2 * pi / dataSize) * (0:(dataSize - 1));

iData = cos(phase);

qData = sin(phase);

theData = iData + 1i * qData;

save('myData.mat', 'theData');

Any variable name is OK because there is only one array in the file.

Example 2. I and Q are created as a real array that has double length.

dataSize = 2560;

phase = 10 * (2 * pi / dataSize) * (0:(dataSize - 1));

iData = cos(phase);

qData = sin(phase);

combined_matrix = [iData; qData];

iqData = transpose(combined_matrix(:));

theData = iqData;

save('myData.mat', 'theData');

Any variable name is OK because there’s only one array in the file.

Example 3. I and Q are two separate arrays. The arrays must be the same size.

data1 = iData;

data2 = qData;

save('mydata.mat', 'data1', 'data2');

The first data and the second data are treated as I and Q respectively.

Example 4. If array names start with either I or Q, the order in the mat file does not matter.

save('mydata.mat', 'qData', 'iData');

The first data and the second data are treated as I and Q respectively.

Example 5. Marker data can be added with two matrix configurations.

Firstly, you can create marker data with 4 x N matrix.

marker4N = int16(zeros(4,dataSize));

marker4N(1,1:1) = 1;  % Marker 1

marker4N(2,1:2) = 1;  % Marker 2

marker4N(3,1:3) = 1;  % Marker 3

marker4N(4,1:4) = 1;  % Marker 4

save('mydata.mat', 'qData', 'iData', 'marker4N');

The Data Type for the marker can be Double, Float, Int32, or Int16. Zero values become zero and non-zero values become 1.

Example 6. Next example uses smaller 1xN size array.

marker1N = int32(zeros(1,dataSize));

marker1N(1) = 15; % Marker 4, 3, 2, 1 = 0b1111 = 15

marker1N(2) = 14; % Marker 4, 3, 2, 1 = 0b1110 = 14

marker1N(3) = 12; % Marker 4, 3, 2, 1 = 0b1100 = 12

marker1N(4) =  8; % Marker 4, 3, 2, 1 = 0b1000 =  8

save('mydata.mat', 'iData', 'qData', 'marker1N');

Example 7. The following is an example of python script that creates a HDF5 file using numpy and h5py modules.

import numpy as np
import h5py
import math

data_size = 2560
phase = 10 * (2 * math.pi / data_size ) * np.arange(0, data_size)
i_data = np.cos(phase)
q_data = np.sin(phase)

marker_data = np.zeros(data_size, dtype=int)
marker_data[0] = 15
marker_data[1] = 14
marker_data[2] = 12
marker_data[3] = 8

with h5py.File("hdf5_data.h5", "w") as hdf:
    hdf.create_dataset('iData', data=i_data)
    hdf.create_dataset('qData', data=q_data)
    hdf.create_dataset('markerData', data=marker_data)

Waveform File (GUI and SCPI description)

Creating Waveform Marker Files